<%@page import="java.util.ArrayList"%>
<%@page import="com.mconnect.msurvey.model.User"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.HashSet"%>
<%@page import="com.mconnect.msurvey.controller.UserManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Admin Panel</title>

<script type="text/javascript">
		$(function() {
			
		$('#chooseUser').click(function(){
				
				var id_users = document.getElementById("id_user").value;
				$.get(
						'reports/userSurveyReportContent.jsp',
						{
							id_user: id_users
							
						},
						function (content) {
							$('#contentUser').html(content);
							
							return false;
						}
					);
				
			});
			
		});
</script>		
</head>
<body>
		<% UserManager uM = new UserManager();
			List<User> loginsList = new ArrayList<User>();
			loginsList = uM.getAllUsersFromDB();%>
			<center>
				<h2>Raport o ankieterze</h2>
				<div id="content1" style=" margin-top: 30px; margin-bottom: 30px; width: 700px; font-size: 13px; ">
							<table style="margin-top: 30px; margin-bottom: 30px;" id="form">
						<tr>
							<td width="150px;">Wybierz ankietera</td>
							<td width="200px;">
								<select name="id_user" id="id_user"  >
								<% for(User user : loginsList){ %>
									<option value="<%=user.getId_user() %>"><%= user.getFirstname() + " " + user.getLastname() %></option>
								<%} %>
								</select>
							</td>
							<td><input type="submit" value="Wyszukaj" style="width:100px; height: 30px;" id="chooseUser"></td>
						</tr>
					</table>
				</div>
				
				<div id="contentUser">
				
				</div>
		</center>
		
</body>
</html>